﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Http;
using System.Web.Mvc;
using System.Web.Routing;

namespace OASystem.App_Start
{
    /// <summary>
    /// 验证是否登录
    /// </summary>
    public class LoginFilterAtrribute : ActionFilterAttribute
    {

        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            if (filterContext.HttpContext.Session["info"] == null)
            {
                filterContext.Result = new RedirectToRouteResult(
               new RouteValueDictionary 
                { 
                    { "controller", "Login" }, 
                    { "action", "Index" }         //需要跳转到的 controller 对应的 action   
                });
            }
        }

         
    }
}